﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Domain;
using System.Collections.Generic;

namespace Domain.Test
{
    [TestClass]
    public class GameUnitTest
    {
        private IList<Domain.Player> players;

        [TestInitialize]
        public void MethodInitialize()
        {
            players = new List<Player>();
            for (int i = 0; i < 15; i++)
            {
                players.Add(new Player("Dom", 21) { PlayerId = i + 1 });
            }
        }



        [TestMethod]
        [ExpectedException(typeof(System.ApplicationException))]
        public void AddPlayerMaxLitiTest()
        {
            //Set up 
            var game = GetGameWithFullList();

            //execution
            game.AddPlayer(new Player("opli", 25) { PlayerId = 51 });

            // Assert
            //Exception is raised 

        }

        private Game GetGameWithFullList()
        {
            var game = new Domain.Game();
            game.GameDateAndTime = DateTime.Now.AddDays(3).AddHours(8);
            game.GameId = 1;
            game.GameStatus = GameStatus.Published;
            for (int i = 0; i < 15; i++)
            {
                game.AddPlayer(players[i]);
            }
            return game;
        }

        
    }
}
